package com.example.springboottrackdemo.interceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 陳樂
 * @version 1.0.0
 * @ClassName WebConfigurer.java
 * @Description TODO
 * @createTime 2023年02月18日 21:08:00
 */
@Configuration
public class WebConfigurer implements WebMvcConfigurer {

    @Bean
    public LogInterceptor logInterceptor(){
        return new LogInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(logInterceptor());
    }
}
